package co.com.services.nucleoeducativo;

import javax.naming.NamingException;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import co.com.smart.maestro.infraestructure.dto.NucleoEducativoDTO;
import co.com.smart.session.DelegateContextEJB;

@Path("/SmartNucleoEducativoService")
public class NucleoEducativoService {
	@GET
	@Path("/getAllNucleoEducativo")
	@Produces(MediaType.APPLICATION_JSON)
	public Response getNucleoEducativo() throws NamingException{
		return Response.ok(DelegateContextEJB.getNucleoEducativoBeanLocal().consultarAllNucleoEducativo())
		.header("Access-Control-Allow-Origin", "*")
		.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
		.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
	}
	
	@POST
	@Path("/getNucleoEducativoId")	
	@Produces(MediaType.APPLICATION_JSON)
	public Response getNucleoEducativoId(NucleoEducativoDTO json) throws NamingException {
		return Response.ok(DelegateContextEJB.getNucleoEducativoBeanLocal().consultarNucleoEducativoId(json))
		.header("Access-Control-Allow-Origin", "*")
		.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
		.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
	}

	@PUT
	@Path("/setNucleoEducativo")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	public Response setNucleoEducativo( NucleoEducativoDTO json){ 
		return Response.ok(DelegateContextEJB.getNucleoEducativoBeanLocal().insertarNucleoEducativo(json))
				.header("Access-Control-Allow-Origin", "*")
				.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
				.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With")
				.build();
	}

	@PUT
	@Path("/editNucleoEducativo")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	public Response setEditNucleoEducativo(NucleoEducativoDTO json){ 
		return Response.ok(DelegateContextEJB.getNucleoEducativoBeanLocal().editNucleoEducativo(json))
		.header("Access-Control-Allow-Origin", "*")
		.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
		.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
	}

	@PUT
	@Path("/removeNucleoEducativo")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	public Response setRemoveNucleoEducativo(NucleoEducativoDTO json){ 
		return Response.ok(DelegateContextEJB.getNucleoEducativoBeanLocal().removeNucleoEducativo(json, true))
				.header("Access-Control-Allow-Origin", "*")
				.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
				.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
	}
	
	@POST
	@Path("/filtrarnucleoseducativos")	
	@Produces(MediaType.APPLICATION_JSON)
	public Response getFiltrarnucleoseducativos(NucleoEducativoDTO json) throws NamingException {
		return Response.ok(DelegateContextEJB.getNucleoEducativoBeanLocal().filtrarnucleoseducativos(json))
		.header("Access-Control-Allow-Origin", "*")
		.header("Access-Control-Allow-Methods", "POST, GET, PUT, UPDATE, OPTIONS")
		.header("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With").build();
	}
}
